package p1;

public class P1T03 {
    public static void main(String[] args) {
//        MyClazz m2=new MyClazz();
        MyDate d1=new MyDate();
        System.out.println(d1);
        d1.setDate(2024,3,11);
        System.out.println(d1);
        MyDate d2=d1;
        System.out.println(d2);
        d2.setMonth(10);
        System.out.println(d1);
        d2=new MyDate();
        System.out.println(d2);
        System.out.println(d1);
        d2.setMonth(5);
        System.out.println(d1);
        d2.setDate(d1);
        System.out.println(d2);
        d2.setMonth(6);
        System.out.println(d1);
        System.out.println(d2);
    }
}
class MyDate{
    private int year;
    private int month;
    private int day;

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }

    public MyDate(int year){
        this.year=year;
        month=1;
        day=1;
    }
    public MyDate(int year,int month){
        this(year);
        this.month=month;
    }
    public MyDate(int year,int month,int day){
        this.year=year;
        this.month=month;
        this.day=day;
    }
    public MyDate(){

    }
    public void setDate(int year,int month,int day){
        this.year=year;
        this.month=month;
        this.day=day;
    }
    public void setDate(MyDate d){
        this.year=d.getYear();
        this.month=d.getMonth();
        this.day=d.getDay();
    }

    @Override
    public String toString() {
//        return "MyDate{" +
//                "year=" + year +
//                ", month=" + month +
//                ", day=" + day +
//                '}';
        return year+"-"+month+"-"+day;
    }

    @Override
    public boolean equals(Object obj) {
        MyDate d=(MyDate) obj;
        return year==d.getYear()&&month==d.getMonth()&&day==d.getDay();
    }

}
